fix: af.ex.Analysis use_jax=True with bare af.Model fallback#1240
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
Smoke Test Results — 2026-04-29
Failures (1 pre-existing, not caused by this PR)autofit_workspace/scripts/overview/overview_1_the_basics.pyPre-existing failure — confirmed by running with canonical Skipped
|
Merged
2 tasks
Collaborator
Author
|
Workspace PR: PyAutoLabs/autofit_workspace_test#17 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
af.ex.Analysis.model_data_1d_fromhad two paths: aCollectionbranch that correctly forwardedxp=self._xpto each profile'smodel_data_from, and a bare-Modelfallback (theexcept TypeErrorbranch, hit wheninstanceis a single non-iterable model component) that calledinstance.model_data_from(xvalues=xvalues)withoutxp. Withuse_jax=Trueon a bareaf.Model(af.ex.Gaussian), this defaultedxptonumpyand triggeredTracerArrayConversionErrorinsidejax.jit. The Collection branch was already updated when_xpwas wired in; the single-instance branch was missed. One-line fix: add, xp=self._xp.Surfaced while building a JAX-jitted Nautilus example in
autofit_workspace_test(separate PR to follow once this lands).API Changes
None — bug fix in example Analysis class.
af.ex.Analysis(use_jax=True)now works with a bareaf.Model; previously it silently degraded to numpy and crashed under JIT.Test Plan
python -m pytest test_autofit/ -xpassesaf.Nautilusoveraf.Model(af.ex.Gaussian)withAnalysis(use_jax=True)runs to completion (verified locally: log_Z ≈ -64.15;JAX: Applying vmap and jit to likelihood functionlog line confirms JIT path was exercised)🤖 Generated with Claude Code